class Gift {
public:
    int getValue(vector<int> gifts, int n) {
        unordered_map<int, int> hash;
        for (auto e : gifts)
        {
            hash[e]++;
        }
        for (auto e : gifts)
        {
            if (hash[e] > n / 2)
                return e;
        }
        return 0;
    }
};